package designPattern.behavioralPattern.iterator;

/**
 * @author wei.zhao
 * @description:
 * @date 2021年12月21日 17:49
 */
public class Test {
    public static void main(String[] args) {
        Aggregate ag = new ConcreteAggregate();
        ag.add("张三");
        ag.add("李四");
        ag.add("王五");
        Iterator it = ag.getIterator();
        while (it.hasNext()) {
            Object ob = it.next();
            System.out.println(ob.toString());
        }
        Object ob = it.first();
        System.out.println("First：" + ob.toString());
    }
}
